package basic.study.wantOffer.chapter2;

/**
 * @author Kevin
 * @date 2020/4/27 14:06
 */
public class Problem5 {
    public static void main(String[] args) {

    }

    private static String change(char[] charArray) {
        int n = charArray.length;
        int count = 0;
        for (int i = 0; i < charArray.length; i++) {
            if (charArray[i] == ' ') {
                count++;
            }
        }
        if (count == 0) {
            return null;
        }
        char[] temp = new char[n + 2 * count];
        int j = n + 2 * count -1;
        int i = n - 1;
        while (i >= 0) {
            if (charArray[i] == ' ') {
                temp[j] = '0';
                temp[j -1] = '2';
                temp[j- 2 ] = '%';
                j -= 3;
            } else {
                temp[j] = charArray[i];
                j--;
            }
            i--;
        }
        return new String(temp);
    }
}
